' Reception Terminal Implementation
' ------------------------------------------------------------------
' Copyright (C) 2012 TEAM
' ------------------------------------------------------------------
' Implementation for a Reception Terminal. Basic functions for room
' assignment.

Option Explicit
Option Base Explicit

#Include ../PassengerCard/PassengerCard.DEF ' Declarations common to BasicCard and Terminal programs

#Include ../Includes/BasicCardUtilities.DEF
#Include ../Includes/BasicCardCommErrors.DEF
#Include ../Includes/BasicCardColours.DEF
#Include ../Includes/CommonTypes.DEF
#Include ../Includes/CommonFunctions.DEF
#Include ../Includes/CommonTerminalFunctions.DEF

#Include Misc.DEF

Call WaitForCard()
ResetCard : Call CheckSW1SW2()

' Check that the application name is correct
Private Name$ : Call GetApplicationID (Name$) : Call CheckSW1SW2()
If Name$ <> ApplicationName$ Then Print "This is not a ShipControl Card!" : Exit


' Get the card data to check if its personalised.
Private cardData as Travel : Call GetCardData(cardData) : Call CheckSW1SW2()
' If the card is not personalied, exit.
If SW1SW2 = swNotPersonalised Then
   Print "Karte nicht personalisiert!" 
   Exit
End If


Print "---------------------------------------------------"
Print "Welcome to ShipControl Reception Terminal."
Print "---------------------------------------------------"

Private currentRoom As Integer
' temp variable for saving the room number. max 4 numbers.
Private newRoom As String*4
Call GetRoomNumber(currentRoom)

If currentRoom <= 0 Then
    Print "No cabine assigned!"
Else
    Print "Currently assigned cabine: " + Str$(currentRoom)
    Print "For Passenger:"
    Print "Name: " + cardData.CustomerForeName + cardData.CustomerName
    Print "Travel: " + cardData.TravelName
End If
    
Print "New cabine number? (just hit enter for removing current cabine)"
Line Input newRoom
Call SetRoomNumber(Val!(newRoom))
' call checksw1sw2 to know whether the card has been removed
Call CheckSW1SW2()

If SW1SW2 = swNoCardInReader Then : Exit : End If

' refresh data
Call GetCardData(cardData)

If Val!(newRoom) = 0 Then
    Print "Cabine numer has been reset."
Else
    Print "New cabine number is now " + Str$(cardData.TravelCabineNumber)
End If

REM Call CheckSW1SW2()

'~ Do
    '~ Cls
    '~ id$ = ShowMenuAndReturnChosenId()
    '~ Select Case id$
    '~ Case "1"
        '~ Call SCSetRoomNumber()
        '~ Exit Case
    '~ Case "2"
        '~ Call SCResetRoomNumber()
        '~ Exit Case
    '~ Case "3"
        '~ Call SCGetRoomNumber()
        '~ Exit Case
    '~ Case "4"
        '~ Exit
    '~ End Select
'~ Loop
